package com.happyrecyclingstation.controller;

import com.happyrecyclingstation.dto.RegisterDto;
import com.happyrecyclingstation.entity.User;
import com.happyrecyclingstation.service.RegisterService;
import com.happyrecyclingstation.utils.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * 登录和注册
 */
@RestController
@Slf4j
public class RegisterController {
    @Autowired
    private RegisterService registerService;

    /**
     * 用户注册
     * @param RegisterDto
     * @return
     */
    @PostMapping("/register")
    public Result register(@RequestBody RegisterDto RegisterDto){
        log.info("用户注册:{}", RegisterDto);
        registerService.register(RegisterDto);
        return Result.success();
    }
}
